package stream.part5;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;

public class Demo02 {
    public static void main(String[] args) {
        List<Integer> integerList = Arrays.asList(1, 66, 2, 77, 33, 88);

        Integer integer = integerList.stream().max(Integer::compareTo).get();
        Integer integer1 = integerList.stream().min(Integer::compareTo).get();
        System.out.println(integer1);
        System.out.println(integer);

        Integer integer2 = integerList.stream().max(Comparator.naturalOrder()).get();
        Integer integer3 = integerList.stream().min(Comparator.naturalOrder()).get();
        System.out.println(integer2);
        System.out.println(integer3);
    }
}
